package com.twu.biblioteca.impl;

import java.util.Scanner;

public class MainMenu {

    private OperateBook operateBook;

    public void showTheMainMenu() {
        String welcomeMessage =
                "********************************************************\n" +
                "*                 Welcome to Biblioteca!               *\n" +
                "*                                                      *\n" +
                "*   Please select your choice:                         *\n" +
                "*   1. View the list of all the books in the library   *\n" +
                "*   2. View the list of movies                         *\n" +
                "*   3. Membership details                              *\n" +
                "*   4. Login                                           *\n" +
                "*   5. Exit                                            *\n" +
                "*                                                      *\n" +
                "********************************************************\n" +
                ">> Please enter your choice:  ";

        System.out.println(welcomeMessage);
    }

    public String getTheChoice() {
        Scanner sc = new Scanner(System.in);
        String customerChoice = sc.nextLine();

        return customerChoice;
    }

    public String checkTheChoiceOfMainMenu(String customerChoice) {
        String theResultOfCustomerChoice = null;

        operateBook = new OperateBook();

        if(customerChoice.equals("1")) {
            theResultOfCustomerChoice = "showTheListOfAllBooks";
        }
        else if (customerChoice.equals("2")) {
            theResultOfCustomerChoice = "showTheListOfMovies";
        }
        else if (customerChoice.equals("3")) {
            theResultOfCustomerChoice = "showTheUserInfo";
        }
        else if (customerChoice.equals("4")) {
            theResultOfCustomerChoice = "login";
        }
        else if (customerChoice.equals("5")) {
            theResultOfCustomerChoice = "exit";
        }
        else {
            System.out.println(">> Select a valid option!!                              \n");
            theResultOfCustomerChoice = "showTheMainMenu";
        }

        return theResultOfCustomerChoice;
    }

}
